<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>角色界面</title>
    <script src="js/jquery-3.3.1.min.js"></script>
    <link rel="stylesheet" href="1.css">
    <link rel="stylesheet" href="role.css">
</head>
<body>
    <div class="top_nav">
        <img src="img/logo.png">
        <ul>
            <a href="index.html"><li>首页</li></a>
            <a href="role.html"><li class="active">角色</li></a><!--将角色页面设为激活状态-->
            <a href="#"><li>攻略</li></a>
            <a href="#"><li>世界</li></a>
            <a href="#"><li>社区</li></a>
        </ul>
    </div>

    <div class="intro_div">

    </div>

    <div class="role_div">
        <img class="role_img" src="img/role/kaiya.png">

    </div>

    <div class="select_div">
        <img src="img/role/left_arrow.png" class="left_arrow">
        <img src="img/role/kaiya_avar.png" class="avartar">
        <img src="img/role/anbo_avar.png" class="avartar">
        <img src="img/role/babala_avar.png" class="avartar">
        <img src="img/role/diluke_avar.png" class="avartar">
        <img src="img/role/lisa_avar.png" class="avartar">
        <img src="img/role/qin_avar.png" class="avartar">
        <img src="img/role/wendi_avar.png" class="avartar">
        <img src="img/role/right_arrow.png" class="right_arrow">

    </div>

    <div class="role_bottom">
        <div style="margin-top: 20px;">
            <span>关于本站</span>
            <span>| 网站招聘</span>
            <span>| 联系我们</span>
            <span>| 游戏截图</span>
            <span>| 玩家投稿</span>
            <span>| 手机客户端</span>
        </div>
        <div>COPY-RIGHT@2022-2099</COPY-RIGHT></div>
        <div>email: xxxxxx@email.com.cn</div>
        <img src="img/logo.png">
    </div>
</body>

<script src="js/role.js" charset="utf-8"></script>
<script type="text/javascript">
    var cur_index = 1;
    var max = 6;

    change(cur_index);
    $(".avartar").each(function(index,e){

        $(this).attr("src",avartar_arr[index]);

        $(this).click(function(){
            cur_index = index;
            change(cur_index);
        })
    })

    $(".left_arrow").click(function(){
        if(cur_index == 0){
            cur_index =  max + 1;
            change(cur_index);
        }
    })
    $(".left_arrow").click(function(){
        if(cur_index > 0){
            cur_index = cur_index - 1;
            change(cur_index);
        }
    })
    $(".right_arrow").click(function(){
        if(cur_index < 6){
            cur_index = cur_index + 1;
            change(cur_index);
        }
    })
    $(".right_arrow").click(function(){
        if(cur_index == 6){
            cur_index = 0;
            change(cur_index);
        }
    })

    function change(cur_index){
        $(".selected").removeClass("selected");
        $(".role_img").attr("src",img_arr[cur_index]);
        $(".intro_div").html(intro_arr[cur_index]);
        $(".avartar:eq(" + cur_index + ")").addClass("selected");
    }

</script>
</html>